import { Component, OnInit } from '@angular/core'
import { Router, ActivatedRoute } from '@angular/router'
import { ApiService as MarketingService } from 'projects/marketing/src/app/services/api.service'
// import { ApiService } from './../../../../../dashboard/src/app/services/dashboard.service';
import { ApiService as CustomerService } from 'projects/customer/src/app/services/api.service'
import { ApiService } from '../../services/api.service'
import {CursorService} from "@core/http/cursor.service";

@Component({
  selector: 'app-product-detail',
  templateUrl: './product-detail.component.html',
  styleUrls: ['./product-detail.component.scss'],
  providers: [MarketingService, CustomerService]
})
export class ProductDetailComponent implements OnInit {
  public id
  public activityList: any = []
  public groupList: any = []
  public productDetaildata: any

  constructor(
    private route: ActivatedRoute,
    private router: Router,
    private marketingService: MarketingService,
    private customerService: CustomerService,
    private apiService: ApiService,
    public cursorService: CursorService,
  ) {}

  ngOnInit() {
    this.id = this.route.snapshot.paramMap.get('id')

    // this.getProductDetail()

    // this.marketingService.getActivityList().subscribe(data => {
    //   this.activityList = data
    // })
    //
    // this.customerService.getCustomerGroupList().subscribe(data => {
    //   this.groupList = data
    // })
    // this.cursorService.statement= "select * where groupcode="+"'"+this.id+"'"
    this.apiService.getProduct(this.id).subscribe(data => {
      console.log('data:'+JSON.stringify(data))
      this.productDetaildata = data
    })
  }

  getProductDetail() {}
}
